/* Copyright (C) 2011 clueless <clueless.mmopeon@gmail.com>
 *
 * This file is part of MMO Peon.
 *
 * MMO Peon is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MMO Peon is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMO Peon.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __MMOPEON_COMMONTYPES_H
#define __MMOPEON_COMMONTYPES_H

#include <cstdint>
#include "classes/coords.h"

// MemObject structure hasn't been verified in months, might need to look over it again
struct MemObject
{
/* 000 */   uint8_t             unknown0[20];
/* 014 */   uint32_t            objectType;	    // Object ID [1]
/* 018 */   uint32_t            objectType2;    // Type of the object [2]
/* 01C */   uint8_t             unknown1[4];
/* 020 */   uint32_t            objectId;       // Object ID as sent by the server
/* 020 */   uint8_t             unknown2[4];
/* 028 */   RomCoords           coords;         // current X Z Y
/* 034 */   RomVectors          vectors;        // X Z Y vectors
/* 040 */   float               speed;          // Current movement speed
/* 044 */   uint8_t             unknown3[16];
/* 054 */   float               modelTiltR;     // how far the model is tilted backwards [5]
/* 058 */   uint8_t             unknown4[8];
/* 060 */   float               modelTiltRW;    // how far the model is tilted backwards [4]
/* 064 */   uint8_t             unknown5[12];
/* 070 */   float               modelScale1;    // Model Scale [5]
/* 074 */   float               modelScale2;    // Model scale
/* 078 */   float               transparency;   // transparancy [6]
/* 07C */   uint8_t             unkwown6[216];
/* 154 */   int32_t             harvesting;     // -1 if not harvesting, following pointers etc are also related to harvesting, unsure how exactly
/* 158 */   uint8_t             unknown7[204];
/* 224 */   uint32_t            flags;          // may be larger [7]
/* 228 */   uint8_t             unknown8[48];
/* 258 */   uint32_t            castId;         // ID of the current casting spell [6]
/* 25C */   float               castMax;        // Total Required cast time in seconds
/* 260 */   float               castNow;        // Cast time elapsed in seconds
/* 264 */   uint8_t             unknown9[4];
/* 268 */   struct RomBuff     *buffStart;      // Pointer to the beginning of the buff struct (More info below struct in comments)
/* 26C */   void               *buffEnd;        // "End pointer" of the buff struct (more info below struct in comments)
/* 270 */   void               *buffMax;        // "max pointer" of the buff struct (more info below struct in comments)
/* 274 */   MemObject          *target;         // Pointer to target structure (read down for more info)
/* 278 */   uint8_t             unknown10[24];
/* 290 */   char               *name;           // Object name
/* 294 */   char               *title;          // Object title
/* 298 */   char               *guild;          // Guildname
/* 29C */   uint8_t             unknown11[44];
/* 2C8 */   uint32_t            health;         // Current health points
/* 2CC */   uint32_t            healthLag;      // Previous health points, right before you took damage
/* 2D0 */   uint32_t            healthMax;      // Maximum health points
/* 2D4 */   uint32_t            power1;         // main class current power
/* 2D8 */   uint32_t            power1Max;      // main class max power
/* 2DC */   uint32_t            power2;         // secondary class current power
/* 2E0 */   uint32_t            power2Max;      // secondary class max power
/* 2E4 */   uint8_t             unknown12[24];
/* 2FC */   uint32_t            class1;         // main class ID
/* 300 */   uint32_t            level1;         // main class level
/* 304 */   uint32_t            class2;         // secondary class ID
/* 308 */   uint32_t            level2;         // secondary class level
/* 30C */   uint8_t             unknown13[50];
/* 33E */   uint8_t             stealth;        // 0x01 = stealthed, 0x00 = visible

//Structure might go even further, this is the last part I could identify
} __attribute__((packed));


struct MemBase
{
 /* 0000 */ uint8_t             unknown0[1432];
 /* 0598 */ MemObject           *player;
 /* 059C */ uint8_t             unknown1[1268];
 /* 0A90 */ uint8_t             movementFlag;
} __attribute__((packed));

extern MemBase *memBase;



#endif
